//
//  UserStatus.swift
//  WeiBo
//
//  Created by 江潘 on 15/6/30.
//  Copyright © 2015年 江潘. All rights reserved.
//

import UIKit

class UserStatus: NSObject {

    var id:Int = 0
    
    var screen_name:String?
    
    var profile_image_url:String?
    
    var verified:Bool = false
    
    var verified_type:Int = -1
    
    var mbrank:Int = 0
    
    var mbrank_img:String?{
    
         return mbrank == 0 ? "" : "common_icon_membership_level\(self.mbrank)"
        
    }
    // swift中设置只读属性，该属性由其他属性来决定自身的值
    var verified_icon:String?{
        
        switch verified_type{
            
        case -1:
        
        return ""
            
        case 0:
        
        return "avatar_vip"
            
        case 1,2,3:
            
        return "avatar_enterprise_vip"
            
        case 10:
        
        return "avatar_grassroot"
            
        default:
            
            return ""
        }
    }
    static let properties = ["id","screen_name","profile_image_url","verified","verified_type","mbrank"]
    
    init(Dict:[String:AnyObject]) {
        super.init()
        
        print(Dict)
        
        for key in UserStatus.properties{
            if Dict[key] != nil{
                
                Dict[key]
                setValue(Dict[key], forKey: key)
            }
        }
    }
    override var description:String {
        
        let dict = dictionaryWithValuesForKeys(UserStatus.properties)
        
        return "\(dict)"
    }
}
